package com.itheima.Demobaozi;

public class baozipu implements Runnable {
    @Override
    public void run() {
        while (true) {
            synchronized ("锁") {
                //判断
                if (Demobz.b.flag == true) {
                    try {
                        "锁".wait();
                    } catch (InterruptedException e) {
                    }
                } else {

                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                    }
                    //修改包子;
                    Demobz.b.pi = "黒黑的面";
                    Demobz.b.xian = "猪肉大葱";
                    System.out.println("薄皮大馅的大包子做好了");
                    //修改状态;
                    Demobz.b.flag = true;
                    //唤醒;
                    "锁".notify();
                }
            }
        }
    }
}
